// composables/useDevice.ts
export const useDevice = () => {
  const headers = useRequestHeaders();
  // const userAgent = headers["user-agent"] || "";

  const userAgent = process.client ? navigator.userAgent : "";

  const isMobile = ref(false);

  const mobileRegex =
    /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
  isMobile.value = mobileRegex.test(userAgent);

  onMounted(() => {
    // document.addEventListener("resize", (e) => {
    //   console.log("resize", e);
    // });
  });

  return { isMobile };
};
